<?php
namespace app\common\model;

use think\model\concern\SoftDelete;

class Shop extends Base
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    
    public function getCateIdAttr($val)
    {
        if($val == 0) return '';

        $ids = explode(',', $val);

        $cateName = '';

        foreach($ids as $id){
            $cateName .= ShopCate::getVal(['id' => $id], 'name');
        }

        return $cateName;
    }

    public function getStatusAttr($val)
    {
        $status = [0 => '待审核', 1 => '已通过', 2 => '已驳回'];
        return $status[$val];
    }

    public function getStartTimeAttr($val)
    {
        if($val == 0) return '';
        return date('Y-m-d H:i:s', $val);
    }
}